home *** CD-ROM | disk | FTP | other *** search
-
-
- NAME
- get_filetime -- get file date/time stamp
-
- SYNOPSIS
- #include <time.h>
- void get_filetime(ptm, fh);
- struct tm *ptm; pointer to tm structure
- int fh; file handle of opened file
-
-
- DESCRIPTION
- Datalight gives a function to set the date/time of a file,
- but none to fetch it!. This function corrects that omission.
- The data from the file is placed in the specified time
- structure (see Datalight "time.h"), in the same format as used
- by other time functions by Datalight. The file must be opened,
- and a file handle passed, NOT a FILE pointer. No error is
- returned from this function. The structure elements tm_wday
- and tm_yday are always returned as 1, as they are generally
- irrelevant for file dates. They can subsequently be calculated
- from the other information.
-
-
-
- EXAMPLE
- #include <time.h>
- #include <smdefs.h>
- FILE *fp;
- char *string;
- struct tm *stamp;
-
- /* report the date/time of a specified file on command line */
- main(argc, argv) int argc; char *argv[]; {
- if(argc isnot 2) exit(0);
- if((fd = fopen(argv[1], "r")) is NULL) exit(0);
- /* note conversion of FILE *fd to file handle next: */
- get_filetime(stamp, (fileno(fd)));
- fclose(fd);
- string = asctime(stamp);
- printf("File %s modified on %s\n", argv[1], string);
- }
-
-
-
-
-
-
-
-
-
- This function is found in SMDLx.LIB for the Datalight Compiler.